package com.esri.core.tasks.na;

import com.esri.core.internal.util.d;
import com.esri.core.map.FeatureSet;
import java.util.ArrayList;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class ServiceAreaResult extends NAResult {
    private FeatureSet facilities;
    private FeatureSet serviceAreaPolygons;
    private FeatureSet serviceAreaPolylines;

    public FeatureSet getServiceAreaPolygons() {
        if (this.serviceAreaPolygons == null) {
            return null;
        }
        FeatureSet featureSet = new FeatureSet();
        featureSet.setGraphics(this.serviceAreaPolygons.getGraphics());
        featureSet.setSpatialReference(this.serviceAreaPolygons.getSpatialReference());
        return featureSet;
    }

    public FeatureSet getServiceAreaPolylines() {
        if (this.serviceAreaPolylines == null) {
            return null;
        }
        FeatureSet featureSet = new FeatureSet();
        featureSet.setGraphics(this.serviceAreaPolylines.getGraphics());
        featureSet.setSpatialReference(this.serviceAreaPolylines.getSpatialReference());
        return featureSet;
    }

    public FeatureSet getFacilities() {
        if (this.facilities == null) {
            return null;
        }
        FeatureSet featureSet = new FeatureSet();
        featureSet.setGraphics(this.facilities.getGraphics());
        featureSet.setSpatialReference(this.facilities.getSpatialReference());
        return featureSet;
    }

    public static ServiceAreaResult fromJson(JsonParser jsonParser) throws Exception {
        if (d.c(jsonParser)) {
            ServiceAreaResult serviceAreaResult = new ServiceAreaResult();
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                String currentName = jsonParser.getCurrentName();
                jsonParser.nextToken();
                if ("saPolygons".equals(currentName)) {
                    serviceAreaResult.serviceAreaPolygons = FeatureSet.fromJson(jsonParser, false, -1);
                } else if ("saPolylines".equals(currentName)) {
                    serviceAreaResult.serviceAreaPolylines = FeatureSet.fromJson(jsonParser, false, -1);
                } else if ("facilities".equals(currentName)) {
                    serviceAreaResult.facilities = FeatureSet.fromJson(jsonParser, false, -1);
                } else if ("barriers".equals(currentName)) {
                    serviceAreaResult.pointBarriers = FeatureSet.fromJson(jsonParser, false, -1);
                } else if ("polylineBarriers".equals(currentName)) {
                    serviceAreaResult.polylineBarriers = FeatureSet.fromJson(jsonParser, false, -1);
                } else if ("polygonBarriers".equals(currentName)) {
                    serviceAreaResult.polygonBarriers = FeatureSet.fromJson(jsonParser, false, -1);
                } else if ("messages".equals(currentName)) {
                    if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
                        serviceAreaResult.messages = new ArrayList();
                        while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                            serviceAreaResult.messages.add(NAMessage.fromJson(jsonParser));
                        }
                    }
                } else {
                    jsonParser.skipChildren();
                }
            }
            return serviceAreaResult;
        }
        return null;
    }

    @Override // com.esri.core.tasks.na.NAResult
    public int hashCode() {
        int hashCode = super.hashCode() * 31;
        FeatureSet featureSet = this.serviceAreaPolygons;
        int hashCode2 = (hashCode + (featureSet == null ? 0 : featureSet.hashCode())) * 31;
        FeatureSet featureSet2 = this.serviceAreaPolylines;
        int hashCode3 = (hashCode2 + (featureSet2 == null ? 0 : featureSet2.hashCode())) * 31;
        FeatureSet featureSet3 = this.facilities;
        return hashCode3 + (featureSet3 != null ? featureSet3.hashCode() : 0);
    }

    @Override // com.esri.core.tasks.na.NAResult
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (super.equals(obj) && getClass() == obj.getClass()) {
            ServiceAreaResult serviceAreaResult = (ServiceAreaResult) obj;
            FeatureSet featureSet = this.serviceAreaPolygons;
            if (featureSet == null) {
                if (serviceAreaResult.serviceAreaPolygons != null) {
                    return false;
                }
            } else if (!featureSet.equals(serviceAreaResult.serviceAreaPolygons)) {
                return false;
            }
            FeatureSet featureSet2 = this.serviceAreaPolylines;
            if (featureSet2 == null) {
                if (serviceAreaResult.serviceAreaPolylines != null) {
                    return false;
                }
            } else if (!featureSet2.equals(serviceAreaResult.serviceAreaPolylines)) {
                return false;
            }
            FeatureSet featureSet3 = this.facilities;
            if (featureSet3 == null) {
                if (serviceAreaResult.facilities != null) {
                    return false;
                }
            } else if (!featureSet3.equals(serviceAreaResult.facilities)) {
                return false;
            }
            return true;
        }
        return false;
    }

    public String toString() {
        return "ServiceAreaResult [Facilities=" + this.facilities + "]";
    }
}
